POST
/
v1
/
customers
/
{id}
/
credits
/
{productId}
/
purchase
Purchase credits
curl --request POST \
  --url https://api.hyperline.co/v1/customers/{id}/credits/{productId}/purchase \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "credit_count": 32,
  "amount_excluding_tax": 123,
  "price_id": "<string>",
  "expires_at": "2024-12-20T16:04:11Z"
}'
{
  "invoice_id": "<string>",
  "new_credit_balance": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required
productId
string
required

Body

application/json

Credit purchase payload

credit_count
number
required

Value indicating a number of credits to add. If price_id is defined, this value must correspond to a full credit pack for the price.

Example:

32

amount_excluding_tax
number

Custom amount for the added credits. Either amount_excluding_tax or price_id must be defined. Expressed in currency's smallest unit.

price_id
string

Price ID used to add credits. The price must be of type bundle. Either amount_excluding_tax or price_id must be defined.

expires_at
string<date-time>

Expiration date for credits linked to this transaction. UTC date time string in the ISO 8601 format.

Example:

"2024-12-20T16:04:11Z"

Response

201 - application/json

Invoice ID and balance after purchase

invoice_id
string
required
new_credit_balance
number
required